package com.zmn.plat.admin.controller.channel.servproduct;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.zmn.common.constant.StatusConsts;
import com.zmn.common.dto2.ResponseDTO;
import com.zmn.common.utils.string.StringUtil;
import com.zmn.plat.admin.controller.channel.ChannelBaseController;

/**
 * 渠道服务产品ModifyController
 *
 * @author linfeng
 * @since 2019 /11/12 15:11:50
 */
@Controller
@RequestMapping("/channel/servProduct/")
public class ChannelServProductModifyController extends ChannelBaseController {

    /**
     * 启用/停用
     *
     * @param ids
     *            the ids
     * @param status
     *            the status
     * @return the result dto
     */
    @RequestMapping(value = "updateStatus")
    @ResponseBody
    @RequiresPermissions("/channel/servProduct/updateStatus.action")
    public ResponseDTO updateStatus(String ids, int status, int channelId) {
        if (StringUtil.isBlank(ids)) {
            return ResponseDTO.fail("请选择产品！");
        }
        channelServProductService.updateStatus(ids, status, channelId, getMcStaff().getRealName());
        // 同步更新服务价格产品状态
        // channelBasePriceService.updateStatus(ids, status, channelId, getMcStaff().getRealName());

        return ResponseDTO.success(StatusConsts.STATUS_SUCCESS, "操作成功！");
    }
}
